<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Create Team</title>
        <ui:include src="../header.xhtml"/>
    </h:head>
    <h:body>
        <h:form>
            <h2><h:outputText value="Create Team"/></h2>
            <h:outputText value="Player1: #{playerManagedBean.currentPlayer}"/><br/>
            <f:view>
                <h:form>

                    <h:dataTable value="#{playerManagedBean.otherPlayers}" var="item" rendered="#{playerManagedBean.doubles}" rowClasses="jsfcrud_odd_row,jsfcrud_even_row">
                        <f:facet name="header">
                            <h:outputText value="Player2: " rendered="#{playerManagedBean.doubles}"/>
                        </f:facet>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Name"/>
                            </f:facet>
                            <h:outputText value="#{item.name}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Surname"/>
                            </f:facet>
                            <h:outputText value="#{item.surname}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Username"/>
                            </f:facet>
                            <h:outputText value="#{item.username}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Join With"/>
                            </f:facet>
                            <h:commandButton value="Join With" action="#{playerManagedBean.createTeamAndJoin(item)}"/>
                        </h:column>
                    </h:dataTable>
                </h:form>
            </f:view>

        </h:form>
    </h:body>
</html>

